<%require 'htmlentities'
coder = HTMLEntities.new
%>

<div class="dashboard-responses">
    <div class="dashboard-my-info-header">
    <%=image_tag("responses.png", :border=>"0px",:height=>"20") -%>
    </div>
    <div class="dashboard-responses-container" >
        <% @advertisment_responses.each do |ad_response| -%>
            <% @response1 = Query.find(:all,:conditions=>"advertisment_id ="+ad_response.id.to_s,:order=>"created_at desc")%>
            <% @count=Query.count(:conditions=>"advertisment_id="+ad_response.id.to_s,:order=>"created_at desc")-%>
            <% if @count != 0%>
                <div class="dashboard-recent-resposes">
                    <div class="dashboard-response-ad">
                        <%= ad_response.title %>
                        <%if !@response1.nil?  -%>
                            <% @response1.each do |responses|%>
                          
                              <div>
                                <%#=  responses.content%>
                                <%=h coder.decode(excerpt(responses.content  , ' ', 30))unless responses.content.nil? -%><a href="">more</a>
                              </div>

                            <%end-%>
                            <div>
                              <%= @count-%>
                            </div>
                        <%end -%>
                    </div>
                    <div class="dashboard-response-no">
                        <a href=""><%=@count%> <% if @count == 1%>response<%else%>responses<%end-%></a>
                    </div>
                </div>
                <div class="parting-line">
                    <hr/>
                </div>
            <% end -%>


        <%end -%>
    </div>
</div>

